<div id="seats_num" data-table-num=<%= @session.try(:session_seat).try(:total_table_count) %> data-table-pernum=<%= @session.try(:session_seat).try(:per_table_num) %> class='hidden'></div>

<div id="current-event" class="hidden" data-current-event=<%=current_event.id%>></div>

<% breadcrumb :set_seat %>

<div class="row">
  <div class="col-lg-12">
    <div class="ibox float-e-margins">
      <div class="ibox-title">
        <h5>座位安排<%= "#{(@session.full_name)}" if @session.present? %></h5>
      </div>
      <div class="ibox-content">
        <div class="container-fluid">
          <div class="row">
            <div id="dispaly-seat" class="col-sm-12 m-b-xs text-right">
              <a id="display-by-seat" class="btn btn-primary">按座位查看</a>
              <a id="display-by-attendee" class="btn btn-primary">按名单查看</a>
              <a id="continue-arrange-seat" class="btn btn-primary hidden">继续安排座位</a>
            </div>

            <form action="/app/events/<%= current_event.id %>/seats" class="form-horizontal" method="post">
              <div class="form-group">
                <label class="col-sm-2 control-label">选择日程</label>
                <div class="col-sm-5">
                  <%=select_tag :session_id, options_for_select(current_event.sessions.map {|s| [s.full_name, s.id]}, url_for), include_blank: false, class: 'input-sm form-control input-s-sm inline'%>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">本场活动需要</label>
                <div class="col-sm-5">
                  <input type="text" class="form-control" id="total-table-count" name="total_table_count" placeholder='数字' />
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">显示方式</label>
                <div class="col-sm-5">
                  <select id="unit" class="form-control" name="unit">
                    <option value="table">桌</option>
                    <option value="row">排</option>
                  </select>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">每桌最多可安排</label>
                <div class="col-sm-5">
                  <input type="text" id="per-table-num" class="form-control" name="per_table_num" placeholder='数字' />
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">是否需要设定座号</label>
                <div class="col-sm-5">
                  <input type="radio" id="show-table-num" name="set_table_num" value="true" checked="true" />是
                  <input type="radio" id="hide-table-num" name="set_table_num" value="false" />否
                </div>
              </div>
              <div class="form-group">
                <div class="col-sm-offset-2 col-sm-8">
                  <button type="submit" class="btn btn-primary"onclick="return check(this.from)" id="set-seat">开始设置</button>
                </div>
              </div>
            </form>

          </div>
        </div>
      </div>
    </div>
  </div>
</div>

<% content_for :script do %>
  <%= javascript_include_tag 'set_seat' %>
<% end %>
<script type="text/javascript">
  function check(){
    if (!$("#total-table-count").val()||!$("#per-table-num").val()) {
      alert('请输入桌数');
      return false;
    }
  }
</script>